<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<%@ include file="/common/meta.jsp" %>
<title>主页</title>
		<link href="${ctx}/styles/master/layout.css" rel="stylesheet" type="text/css"/>
		<link href="${ctx}/styles/master/screen/basemod_msg.css" rel="stylesheet" type="text/css"/>
		<%@ include file="/common/jquery.jsp" %>
				<script src="${ctx}/scripts/table.js" type="text/javascript"></script>
<!--[if lte IE 7]>
<link href="${ctx}/styles/master/patches/patch_layout.css" rel="stylesheet" type="text/css" />
<![endif]-->

<script type="text/javascript">
function setAllCheckboxState(name,state) {
	var elms = document.getElementsByName(name);
	for(var i = 0; i < elms.length; i++) {
		elms[i].checked = state;
	}
}
function batchDelete(action,checkboxName,form){
    if (!hasOneChecked(checkboxName)){
            alert('请选择要操作的对象!');
            return;
    }
    if (confirm('确定执行[删除]操作?')){
        form.action = action;
        form.submit();
    }
}
function hasOneChecked(name){
    var items = document.getElementsByName(name);
    if (items.length > 0) {
        for (var i = 0; i < items.length; i++){
            if (items[i].checked == true){
                return true;
            }
        }
    } else {
        if (items.checked == true) {
            return true;
        }
    }
    return false;
}
</script>
<script type="text/javascript">
	$(document).ready(function() {
		var type = '${fontype}';
		var mm = '${mm}';
		if(type != null){
			if(type=="1") 
				$("#fon-2").addClass("active");
			if(type=="2") 
				$("#fon-1").addClass("active");
		}
		if(mm != null){
			$("#acc${mm}").addClass("active");
		}
		$.post("${ctx}/app/messageinfo!getNoReadCount.action",{
			fontype:"2"},function(data){
				$("#notice").html(data);
			});
		$.post("${ctx}/app/messageinfo!getNoReadCount.action",{
			fontype:"1"},function(data){
				$("#system").html(data);
			});
		});
</script>
<style type="text/css">
  .page_margins { min-width:70px; max-width:80em; background:#fff; }
</style>
</head>
<body >
<div class="page_margins">
  <div id="as" >
    <!-- begin: main navigation #nav -->
    <div id="nav" role="navigation">
      <div id="tags" >
        <ul>
           <li id="fon-1"><a href="${ctx}/app/messageinfo.action?fontype=2&sr=${sr}&mm=${mm}" >通知(<span id="notice">0</span>)</a></li>
           <li id="fon-2"><a href="${ctx }/app/messageinfo.action?fontype=1&sr=${sr}&mm=${mm}" >系统消息(<span id="system">0</span>)</a></li>
        </ul>
        <input type="hidden" name="fontype" value="${fontype }"/>
      </div>
    </div>
    <!-- end: main navigation -->
    <!-- begin: main content area #main -->
    <div id="main">
      <!-- begin: #col1 - first float column -->
      <div id="col1" role="complementary">
        <div id="col1_content" class="clearfix">
        <ul id="" class="msgul">
        <li id="acc6"><a href="${ctx}/app/messageinfo!input.action?mm=6&fontype=2">发送消息</a></li>
        <li id="acc4"><a href="${ctx}/app/messageinfo.action?sr=s&mm=4&fontype=${fontype}">发件箱</a></li>
        <li id="acc5"><a href="${ctx}/app/messageinfo.action?sr=r&mm=5&fontype=${fontype}">收件箱</a>
		<ul>
		<li id="acc1"><a href="${ctx}/app/messageinfo.action?mm=1&fontype=${fontype}&sr=r">今天</a></li>
		<li id="acc2"><a href="${ctx}/app/messageinfo.action?mm=2&fontype=${fontype}&sr=r">昨天</a></li>
		<li id="acc3"><a href="${ctx}/app/messageinfo.action?mm=3&fontype=${fontype}&sr=r">更早</a></li>
		</ul>
		</li>
	</ul>
        </div>
      </div>
      <!-- end: #col1 -->
      <!-- begin: #col3 static column -->
      <div id="col3" role="main" >
        <div>

 <form id="mainForm" action="${ctx}/app/messageinfo.action" method="get" class="yform" style="height: 330px">
 	 <input type="hidden" value="${mm}" name="mm"/>
 	 <input type="hidden" value="${sr}" name="sr"/>
 	 <input type="hidden" value="${fonttype}" name="fonttype"/>
 	<div id="caption" ><h6>
         <c:if test="${sr!='s' }"> 收件箱</c:if>
        <c:if test="${sr=='s' }"> 发件箱</c:if></h6></div>
<table >
<tr>
<th style="width:5px"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"/></th>
<c:if test="${sr=='s' }">
<th style="width:60x"><a href="javascript:sort('receiveUser','desc')">收件人</a></th></c:if>
<c:if test="${sr!='s' }">
<th style="width:50px"><a href="javascript:sort('sendUser','asc')">发送人</a></th></c:if>
<th colspan="2" style="width:200x; text-align:left"><a href="javascript:sort('subject','asc')">消息名称</a></th>
<th height="17px" style="width:67px"><a href="javascript:sort('grade','asc')">消息级别</a></th>
<th style="width:125px"><a href="javascript:sort('sendDate','asc')">发送时间</a></th>
</tr>
<c:forEach items="${page.result}"  var="m">
<tr  valign="top">
<td><input type="checkbox" name="items" value="${m.id}"/></td>
<c:if test="${sr=='s' }">
<td><pt:labels type="userId" argument1="${m.receiveUser}" single="true"></pt:labels></td></c:if>
<c:if test="${sr!='s' }">
<td><pt:labels type="userId" argument1="${m.sendUser }" single="true"></pt:labels></td></c:if>
<td align="left" style="width:5px" >
   <c:if test="${sr=='r' }">
   <c:choose>
   <c:when test="${m.readFlag=='1' }"><img src="${ctx}/images/open.png" height="14px" /></c:when>
   <c:otherwise><img src="${ctx}/images/close.png" height="14px" /></c:otherwise>
   </c:choose>
   </c:if>
   <c:if test="${sr=='s' }"><img src="${ctx}/images/open.png" height="14px" /></c:if>
   </td>
   <td align="left">
   <a title="${m.subject}" href="${ctx }/app/messageinfo!view.action?id=${m.id}&sr=${sr}&mm=${mm}&fontype=${fontype}">
   <pt:text limit="8">${m.subject}</pt:text>
   </a></td>
<td height="10px"><pt:code category="1009" code="${m.grade }" ></pt:code></td>
<td><fmt:formatDate value="${m.sendDate}" pattern="yyyy-MM-dd HH:mm"/></td>
</tr>
</c:forEach>
</table>
<jsp:include page="/common/page.jsp" flush="true" />
<div class="type-button">
<input id="delMessage" type="button" onclick="batchDelete('${ctx}/app/messageinfo!delete.action?mm=${mm}&fontype=${fontype}&sr=${sr}','items',document.forms.mainForm)" value="删除" />
</div>
</form>
        </div>
        <div id="ie_clearing">&nbsp;</div>
        <!-- End: IE Column Clearing -->
      </div>
      <!-- end: #col3 -->
    </div>
    <!-- end: #main -->
  </div>
  </div>
<!-- full skip link functionality in webkit browsers -->
<script src="${ctx}/scripts/plugin/focusfix.js" type="text/javascript"></script>
</body>
</html>

